﻿Public Class fApuntes
    Dim mycon As New Conexion
    Private Sub fApuntes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Dim proceso As New System.Diagnostics.Process
        'car.ShowDialog()
        Timer1.Start()
        Label5.Text = ip
        'Process.Start("C:\Program Files\Google\Chrome\Application\chrome.exe", "http://" & ip & "/PortalWeb/ModoCliente/")
        Dim size As Size
        size = System.Windows.Forms.SystemInformation.PrimaryMonitorSize
        Dim width, height As Integer
        width = size.Width / 2
        height = size.Height
        Me.Height = height
        Me.Width = width
        Me.SetDesktopLocation(0, 0)
        Me.Show()
        'Me.Visible = False
        'Me.ShowInTaskbar = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        exportarPdf(txtApuntes.Text)
        'PDF VIEWER
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim obj
        obj = CreateObject("sapi.spvoice")
        obj.speak(txtPreguntas.Text)
    End Sub

    Private Sub VolverAMenuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VolverAMenuToolStripMenuItem.Click
        Me.Hide()
        Main.Show()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        autoSave(txtApuntes.Text, "C:\Archivos BookVoice\Temp\ApuntesTemp.txt")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If My.Computer.FileSystem.FileExists("C:\Archivos BookVoice\Temp\Archtemp.txt") Then

            ' mycon.guardarApunte()

            Dim texto As String = AbrirArchivo("C:\Archivos BookVoice\Temp\Archtemp.txt")
            Dim ids As String() = texto.Split(",")
            Dim id_archivo As String() = ids(1).Split(vbNewLine)

            myAsignatura.myId = ids(0).ToString
            myAsignatura.myNombre = (mycon.getAsignatura(ids(0).ToString))
            myArchivo.myId = id_archivo(0).ToString
            
            mycon.agregarApunte()


            My.Computer.FileSystem.WriteAllText(myApunte.myUrl, txtApuntes.Text, True)
            My.Computer.FileSystem.DeleteFile("C:\Archivos BookVoice\Temp\Archtemp.txt")


            MessageBox.Show("Apuntes Guardados Exitosamente!", "BookVoice", MessageBoxButtons.OK, MessageBoxIcon.Information)
            txtApuntes.Text = ""
        Else
            MsgBox("Debe Guardar el archivo de transcripción primero!")
        End If
    End Sub

End Class